本贴会记录我的主题魔改教程
1.首页友人帐随机显示6个博客而不是固定最后6个

在/wp-content/themes/oyiso/modules/get-home-newest.php中
大概58行将usort改成shuffle($bookmarks)
if (!empty($bookmarks)) {
// usort($bookmarks, function($a, $b) {
// return $b->link_id - $a->link_id;
// });
shuffle($bookmarks);
$bookmarks = array_slice($bookmarks, 0, $limit);
}
2.在首页添加下一页

在/wp-content/themes/oyiso/templates/tpl-home1.php中修改2处
在103行的$latest = new WP_Query() 中添加参数
'paged' => get_query_var('paged', 1), // 当前页数
在168行的代码
<?php endif; wp_reset_postdata();?>
</ul>
下添加
<?=the_pagination($latest)?>
完整代码如下:
<section class="lastest">
<div class="screen">
<div class="screen-title main-reveal">Newest</div>
<ul>
<?php $post_i = 1; ?>
<?php
// 创建 latest 实例
$latest = new WP_Query(
array(
'post_type' => 'post', // 文章类型
'posts_per_page' => 9, // 每页显示的文章数量
'paged' => get_query_var('paged', 1), // 当前页数
'ignore_sticky_posts' => 1, // 排除置顶文章
'orderby' => 'date', // 日期类型的排序
'order' => 'DESC' // 降序排列
)
);
···· 代码省略 ····
<?php $post_i++; ?>
<?php endwhile; else : ?>
<style>
main .lastest ul {
display: block;
}
</style>
<?=notice('warning', '', "There are currently <b>no latest posts</b> available.")?>
<?php endif; wp_reset_postdata();?>
</ul>
<?=the_pagination($latest)?>
</div>
</section>
3.支持插件
Oysio主题默认不支持任何插件,原因是作者未在开发中埋下任何WordPress自带的Hook
在/wp-content/themes/oyiso/footer.php中修改1处
在97行的代码
<script>
popupNotify(`<?=$notice_text?>`)
上方添加
<?=wp_footer();?>
捐助名单
参与讨论